﻿using System;

namespace my_console
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = { 10, 5, 7, 3, 15, 20 }; 

            int max = FindMax(numbers);
            int min = FindMin(numbers);
            double average = CalAverage(numbers);
            int sum = CalSum(numbers);

            Console.WriteLine(max);
            Console.WriteLine(min);
            Console.WriteLine(average);
            Console.WriteLine(sum);

            Console.ReadLine();
        }

        static int FindMax(int[] arr)
        {
            int max = arr[0];
            for (int i = 1; i < arr.Length; i++)
            {
                if (arr[i] > max)
                {
                    max = arr[i];
                }
            }
            return max;
        }

        static int FindMin(int[] arr)
        {
            int min = arr[0];
            for (int i = 1; i < arr.Length; i++)
            {
                if (arr[i] < min)
                {
                    min = arr[i];
                }
            }
            return min;
        }

        static double CalAverage(int[] arr)
        {
            int sum = CalSum(arr);
            return (double)sum / arr.Length;
        }

        static int CalSum(int[] arr)
        {
            int sum = 0;
            foreach (int num in arr)
            {
                sum += num;
            }
            return sum;
        }
    }
}
